package com.longge;

import java.util.HashMap;
import java.util.Map;

/**
 * @program: my-code
 * @description:
 * @author: longge
 * @create: 2021-04-27 00:04
 */
public class RemoveStones {
    public int removeStones(int[][] stones) {
        UF1 uf1 = new UF1();
        for (int[] stone : stones) {
            uf1.union(stone[0], stone[1] + 10000);
        }
        return stones.length - uf1.count();

    }
    public static void main(String[] args) {
        new RemoveStones().removeStones(new int[][]{{0,0},{0,2},{1,1},{2,0},{2,2}});
    }
}
